package com.girlbook.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.girlbook.dao.ArticleDAO;
import com.girlbook.model.Article;


@Service
public class ArticleService 
{
	@Autowired
	private ArticleDAO articleDAO;
	
	/**
	 * 文章保存
	 * @param article
	 */
	public void save(Article article)
	{
		articleDAO.save(article);
	}

	/**
	 * 根据ID文章查询
	 * @param artId
	 * @return
	 */
	public Article queryById(int artId)
	{
		return articleDAO.queryById(artId);
	}

	/**
	 * 分页查询
	 * @param pageSize
	 * @param pageNo
	 * @return
	 */
	public List<Article> queryListByPage(int pageSize, int pageNo)
	{
		return articleDAO.queryListByPage((pageNo-1)*pageSize, pageSize);
	}

	/**
	 * 
	 * @return
	 */
	public int queryTotal()
	{
		return articleDAO.queryTotal();
	}
}
